/*
 * @Author: 詹真琦(legendryztachi@gmail.com)
 * @Date: 2021-10-18 11:09:45
 * @LastEditors: 詹真琦(legendryztachi@gmail.com)
 * @LastEditTime: 2022-04-14 16:18:19
 * @FilePath: \code\cwp-front\pc-collaboration\src\handles\handle-list\summary\index.js
 * @Description:新建、处理页面各种操作
 */
import { getCamelCase } from '@/plugins/methods';
import {fireEvent, getCollEventParams} from "@/handles/common/sdk";
import {useBaseInfoStore} from "@/store/modules/base-info";
import globalData from "@/plugins/data";
const files = require.context('./modules', true, /.js$/);
const handObj = {};
let useBaseInfo = useBaseInfoStore();
files.keys().forEach((key) => {
    handObj[getCamelCase(key.replace(/\.\/(.*)\.js/, '$1').replace(/\/index/g, ''))] =
        files(key).default;
});
export default handObj;
export function doHandle(handleName, params) {
    let handler = handObj[handleName];
    if (handler) {
        return handler.call(this, params);
    }
    const businessData = useBaseInfo.baseInfo?.businessData || {};
    let collEventParams = getCollEventParams(businessData,globalData,params);
    return fireEvent(handleName, collEventParams);
}
